﻿using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
//#JMJ Create_20241124

namespace IHateWorking.Model
{
    public class Converter_MatchPara2VisibleOrCollapesd : IValueConverter
    {
        /// <summary>
        /// 根据变量值与参数值的匹配与否，返回控件的显示/折叠状态
        /// </summary>
        /// <param name="value">变量值</param>
        /// <param name="targetType"></param>
        /// <param name="parameter"></param>
        /// <param name="culture"></param>
        /// <returns></returns>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value != null)
            {
                if (System.Convert.ToInt32(value) == System.Convert.ToInt32(parameter))
                { return Visibility.Visible; }
            }
            return Visibility.Collapsed;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return Binding.DoNothing;
        }
    }
}
